package A02;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Test1 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"封禁","哈哈","小明");
        Random r = new Random();
        int index = r.nextInt(list.size());
        String name = list.get(index);
        System.out.println(name);

//        第二种
//        Collections.shuffle(list);
//        String name = list.get(0);
//        System.out.println(name);

    }
}
